package org.swidgets.base.slabel;



import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasWordWrap;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MouseListener;
import com.google.gwt.user.client.ui.MouseWheelListener;
import com.google.gwt.user.client.ui.SourcesClickEvents;
import com.google.gwt.user.client.ui.SourcesMouseEvents;
import com.google.gwt.user.client.ui.SourcesMouseWheelEvents;
import com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant;

public class SLabel extends Composite implements SourcesClickEvents,
SourcesMouseEvents, SourcesMouseWheelEvents,
 HasText, HasWordWrap {
	
	private Label label = new Label();
	
	private static final class SLabelStyle{
		public SLabelStyle(){
			
		}
	}
	public static final SLabelStyle DEFAULT_LABEL_STYLE=new SLabelStyle();
	public static final SLabelStyle SMALL_LABEL_STYLE=new SLabelStyle();
	public static final SLabelStyle TITLE_LABEL_STYLE=new SLabelStyle();
	public static final SLabelStyle SMALL_TITLE_LABEL_STYLE=new SLabelStyle();
	private static final boolean isDesignTime() {
		return false;
	}
	public SLabel() {
		
		super();
		initWidget(label);
		label.setStyleName("defaultLabel");
		if (isDesignTime()) {
			label.setText("Label");		
		}
	}

	public SLabel(String string) {
		initWidget(label);
		label.setText(string);
		label.setStyleName("defaultLabel");
	}
	
	
	public void setStyle(SLabelStyle sLabelStyle){
		if(sLabelStyle==DEFAULT_LABEL_STYLE)
			label.setStyleName("defaultLabel");
		if(sLabelStyle==SMALL_LABEL_STYLE)
			label.setStyleName("smallLabel");			
		if(sLabelStyle==SMALL_TITLE_LABEL_STYLE)
			label.setStyleName("smallTitle");
		if(sLabelStyle==TITLE_LABEL_STYLE)
			label.setStyleName("titleLabel");
		
	}
	
	public SLabel(String string, SLabelStyle sLabelStyle) {
		initWidget(label);
		label.setText(string);
		setStyle(sLabelStyle);
	}
	public String getText() {
		return label.getText();
	}
	public void setText(String text) {
		label.setText(text);
	}
	public void addMouseListener(MouseListener listener) {
		label.addMouseListener(listener);
	}
	public void removeMouseListener(MouseListener listener) {
		label.removeMouseListener(listener);
	}
	public boolean getWordWrap() {
		return label.getWordWrap();
	}
	public void setWordWrap(boolean wrap) {
		label.setWordWrap(wrap);
	}
	public void addClickListener(ClickListener listener) {
		label.addClickListener(listener);
	}
	public void addMouseWheelListener(MouseWheelListener listener) {
		label.addMouseWheelListener(listener);
	}
	public void addStyleDependentName(String styleSuffix) {
		label.addStyleDependentName(styleSuffix);
	}
	public void addStyleName(String style) {
		label.addStyleName(style);
	}
	
	public int getAbsoluteLeft() {
		return label.getAbsoluteLeft();
	}
	public int getAbsoluteTop() {
		return label.getAbsoluteTop();
	}
		
	public String getStyleName() {
		return label.getStyleName();
	}
	public String getStylePrimaryName() {
		return label.getStylePrimaryName();
	}
	public String getTitle() {
		return label.getTitle();
	}
	
	
	public void onBrowserEvent(Event event) {
		label.onBrowserEvent(event);
	}
	public void removeClickListener(ClickListener listener) {
		label.removeClickListener(listener);
	}
	public void removeMouseWheelListener(MouseWheelListener listener) {
		label.removeMouseWheelListener(listener);
	}
	public void removeStyleDependentName(String styleSuffix) {
		label.removeStyleDependentName(styleSuffix);
	}
	public void removeStyleName(String style) {
		label.removeStyleName(style);
	}
	public void setHeight(String height) {
		label.setHeight(height);
	}
	public void setHorizontalAlignment(HorizontalAlignmentConstant align) {
		label.setHorizontalAlignment(align);
	}

	public void setStyleName(String style) {
		label.setStyleName(style);
	}
	public void setStylePrimaryName(String style) {
		label.setStylePrimaryName(style);
	}
	public void setTitle(String title) {
		label.setTitle(title);
	}
	public void setVisible(boolean visible) {
		label.setVisible(visible);
	}
	
	
	
}